package com.zhz.redisdemo.service.impl;

import com.zhz.redisdemo.entity.UserBean;
import com.zhz.redisdemo.repository.UserBeanRepository;
import com.zhz.redisdemo.service.UserBeanService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@CacheConfig(cacheNames = "UserBeanService")
public class UserBeanServiceImpl implements UserBeanService {
    @Resource
    private UserBeanRepository userBeanRepository;

    @Override
    @Cacheable(value = "getSysUserListBiz",keyGenerator = "keyGenerator")
    public UserBean getUser(String usrName) {
        return userBeanRepository.findUserBeanByUsrName(usrName);
    }
}
